package com.wmh.baseservice.operationaid.mapper;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wmh.baseservice.operationaid.entity.ProductPicture;

import java.util.List;
import java.util.stream.Collectors;

/**
 * @author 牛威龙
 * @description 针对表【operation_aid_product_picture】的数据库操作Mapper
 * @createDate 2023-07-07 12:38:51
 * @Entity com.wmh.baseservice.operationAid.entity.ProductPicture
 */
public interface ProductPictureMapper extends BaseMapper<ProductPicture> {
    default List<String> getCategory(){
        return selectList(new LambdaQueryWrapper<ProductPicture>()
                .groupBy(ProductPicture::getCategory)
                .orderByDesc(ProductPicture::getCreateTime)
                .select(ProductPicture::getCategory)
        ).stream().map(ProductPicture::getCategory).collect(Collectors.toList());
    }
}
